<?php
abstract class ColorRotator {

    private static $_colors = array();

    private static $_index = 0;

    public static function add($color) {

        ColorRotator::$_colors[] = $color;
    }

    public static function process() {

        if (!isset(ColorRotator::$_colors[ColorRotator::$_index])) {
            return null;
        }

        $color = ColorRotator::$_colors[ColorRotator::$_index++];

        if (ColorRotator::$_index == count(ColorRotator::$_colors)) {

            ColorRotator::$_index = 0;
        }

        return $color;
    }
}
?>